package com.future;

/**
 * Description: 674. 最长连续递增序列
 *
 * @author weiruibai.vendor
 * Date: 2022/6/28 17:40
 */
public class Solution_674 {

    public static void main(String[] args) {
        int[] nums = {5, 3, 2, 6, 9, 4, 5, 8, 10, 15};
        System.out.println(findLengthOfLCIS(nums));
    }

    /**
     * 注意：最长连续递增子序列！！！
     *
     * @param nums
     * @return
     */
    public static int findLengthOfLCIS(int[] nums) {
        if (nums == null || nums.length == 0) {
            return 0;
        }
        if (nums.length < 2) {
            return 1;
        }
        int N = nums.length;
        int start = 0;
        int ans = 1;
        for (int i = 1; i < N; i++) {
            if (nums[i - 1] >= nums[i]) {
                ans = Math.max(ans, i - start);
                start = i;
            }
        }
        ans = Math.max(ans, N - start);
        return ans;
    }
}
